/**
 * Created by webrx on 2024/4/26.
 */
import {createWebHashHistory, createRouter} from 'vue-router'
import type {RouteRecordRaw} from 'vue-router'

const routes: RouteRecordRaw[] = [
    {
        path: '/login',
        name: 'login',
        meta: {title: '会员登录'},
        component: () => import('@/views/login.vue'),
    },
    {
        path: '/',
        meta: {ismenu: true, icon: 'Edit', title: '会员中心'},
        component: () => import('@/views/home.vue'),
        // redirect: to => {
        //     return {path: 'center'}
        // },
        // redirect: 'center', 如果没有写，可以在子路由中默认加载path为''路由项
        children: [
            {
                path: 'member',
                meta: {title: '会员登录'},
                component: () => import('@/views/member.vue'),
            }, {
                path: '',
                component: () => import('@/views/center.vue'),
            },
            {
                path: 'info',
                meta: {title: '会员信息'},
                component: () => import('@/views/info.vue'),

            }
        ]
    }, {
        path: '/notfound',
        name: 'notfound',
        component: () => import('@/views/NotFound.vue'),
    }, {
        path: '/:catchAll(.*)', //404
        redirect: '/notfound', //重定向到NotFound视图
    }

]
const router = createRouter({
    history: createWebHashHistory(),
    routes
})


export default router
